package com.xyl.controller;

import com.xyl.pojo.User;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;

public class TwoController implements Controller {
    @Override
    public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        List<User> list = new ArrayList<>();
        list.add(new User(1,"张三","男"));
        list.add(new User(1,"王伟","男"));
        list.add(new User(1,"赵公明","男"));

        ModelAndView mav = new ModelAndView();
        mav.setViewName("/WEB-INF/jsp/one.jsp");
        mav.addObject("userlist",list);
        // try{
        //     Thread.sleep(5000);
        // }catch (Exception e){
        //     e.printStackTrace();
        // }
        return null;
    }
}
